package com.coderman.topn;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author fanchunshuai
 * @Date 2019/11/22 23
 * @Description:
 */
public class KVPairTest {
    public static void main(String[] args) {
        //setTest();
        //listTest();
        //mapTest();
        long startTime = System.currentTimeMillis();
        //List list = new ArrayList(1000);
        Map<String,String> map = new HashMap<>(100000);
        long endTime = System.currentTimeMillis();
        System.out.println(endTime - startTime);

    }



    public static void mapTest(){
        //Map<String,KVPair<String,Integer>> map = new HashMap<>();
        Map<KVPair<String,Integer>,KVPair<String,Integer>> map = new HashMap<>();

        for (int i  =0;i < 100000000;i++){
            //map.put(i+"",KVPair.build(55555+"",100000));
            map.put(KVPair.build(55555+"",100000),KVPair.build(55555+"",100000));
            if(i % 100000 == 0){
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static void setTest(){
        Set<KVPair<String,Integer>> set = new HashSet<>();
        for (int i  =0;i < 100000000;i++){
            set.add(KVPair.build(55555+"",100000));
            if(i % 100000 == 0){
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static void listTest(){
        List<KVPair<String,Integer>> list = new ArrayList<>();

        for (int i  =0;i < 100000000;i++){
            list.add(KVPair.build(55555+"",100000));
            if(i % 100000 == 0){
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
